package com.maimao.info.service;

import com.maimao.core.exception.MaiMaoDaoException;
import com.maimao.info.mapper.IntegralActionMapper;
import com.maimao.model.info.IntegralAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2021/1/21 4:28 下午
 */
@Service
public class IntegralActionService {

    @Autowired
    private IntegralActionMapper integralActionMapper;

    @Transactional(rollbackFor = MaiMaoDaoException.class)
    public void addBatch(List<IntegralAction> integralActionList) {
        integralActionMapper.insertBatch(integralActionList);
//        throw new RuntimeException("出异常啦");
    }

    public List<IntegralAction> userIntegralActionData(Long userId) {
        return integralActionMapper.selectByUserId(userId);
    }
}
